#pragma once

#include <vector>
#include "ElectrodeTable.h"
struct Channel{
	int electrodeID;
	std::vector<double> data;
	Electrode electrode;
	Channel(int id):electrodeID(id),electrode(id){}
};
class DataStore
{
private:
	std::vector<Channel> data;
	int current, samplingRate;
	int refType;//refType=-1 for reset
	Channel* refChannel[3];
public:
	DataStore(void);
	~DataStore(void);
	const Channel& GetChannel(int n);
	int AddChannel(int eid);
	int EndChannel(void);//return the size of a ch.
	void AddData2Channel(double d);
	void CleanAll(void);
	void SetSamplingRate(int s){samplingRate=s;}
	int GetSamplingRate(){return samplingRate;}
	int GetChannelCount(void);
	void SetChannelName(LPCTSTR name);
	void SetRef(int refType);
	// Get the index of the channel from a given electrodeID. Return -1 if the that electrode is not available.
	int GetElectrode(int electrodeID);
	bool GetRefData(int ch, UINT index,double &refData);//return false if refType==-1. But in that case, refData=data[ch].data[index]
	 Channel* GetChannelByEID(unsigned int eid);
};
